home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
winlib3.zip
/
VIDSYS.H
< prev
next >
Wrap
Text File
|
1991-01-14
|
9KB
|
235 lines
/**********************************************
* Define video and other miscellaneous flags *
*********************************************/
#ifndef VSTRUCT_DEF
#include <proto.h>
#if defined (POWERC)
#define crt_status_port crtport
#define pagesize_ pagesiz_
#define caldelay_ caldely_
#endif
#ifndef offsetof
#define offsetof(type,memb) \
(unsigned)&((( type *)0x10)->memb)-(unsigned)(( type *)0x10)
#endif
/*************************
* Define Screen segments *
*************************/
#define MONO 0xB000
#define COLOR 0xB800
#define MAXBUFSIZE 1024
#define MAXSCROLLWIDTH 140
/********************************
* Define video block structure *
*******************************/
typedef struct
{
int upx; /* upper left column where
video block is defined */
int upy; /* upper row */
int lowx; /* lower right column */
int lowy; /* lower row */
int pagenum; /* page number where block
is opened */
char *scrnsave; /* pointer to video block
structure */
} *VBLOCKPTR, VBLOCK;
typedef struct
{
unsigned scrnwrt_flag:1; /* either BIOS or DMA */
unsigned cga_flag:1; /* cga flag */
unsigned mda_flag:1; /* mono adapter flag */
unsigned vga_in_flag:1; /* vga installed flag */
unsigned vga_c_flag:1; /* vga color mode on */
unsigned vga_m_flag:1; /* vga mono mode on */
unsigned mcga_c_flag:1; /* MCGA color on */
unsigned mcga_m_flag:1; /* MCGA mono on */
unsigned ega_in_flag:1; /* ega installedf flag */
unsigned ega_a_flag:1; /* ega active flag */
unsigned ega_c_flag:1; /* ega is in color mode flag */
unsigned ega_m_flag:1; /* ega is in mono mode flag */
} SYS_FLAGS;
typedef struct
{
unsigned int video_mode;
unsigned int cursor_startline;
unsigned int cursor_endline;
unsigned int video_page;
unsigned int video_pagesize;
unsigned int video_rows;
unsigned int video_cols;
unsigned int char_height;
unsigned int crt_port_address;
unsigned int crt_mode_setting;
unsigned int crt_color_setting;
} VIDEO_CONFIG;
#if defined (GLOBAL_DEF)
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN VIDEO_CONFIG initial_video_startup;
EXTERN int is_vga_color;
EXTERN int default_screen_attr; /* default screen attribute */
EXTERN int default_screen_tab_length;
EXTERN unsigned scrnseg_;
EXTERN unsigned char chksnow_;
EXTERN SYS_FLAGS video_system_flags;
EXTERN unsigned crt_status_port;
EXTERN int num_screen_rows; /* current # of rows displayed */
EXTERN int num_screen_cols; /* current # of columns displayed */
EXTERN int max_video_pages;
EXTERN int active_video_page; /* current active display page */
EXTERN int visible_video_page; /* current visible display page */
EXTERN unsigned int pagesize_; /* size of video page in bytes */
EXTERN int current_video_mode; /* current video mode */
EXTERN unsigned char window_char_buffer[MAXBUFSIZE]; /* global write buffer */
EXTERN unsigned char virtual_char_buffer[MAXBUFSIZE];
EXTERN unsigned char scroll_char_buffer[MAXSCROLLWIDTH];
EXTERN unsigned caldelay_;
/*******************
* Define box types *
********************/
#define DOUBLEBOX "╔═╗║║╚═╝"
#define SINGLEBOX "┌─┐││└─┘"
#define MIXEDBOX1 "╒═╕││╘═╛"
#define MIXEDBOX2 "╓─╖║║╙─╜"
#define HATCHBOX1 "░░░░░░░░"
#define HATCHBOX2 "▒▒▒▒▒▒▒▒"
#define HATCHBOX3 "▓▓▓▓▓▓▓▓"
#define SOLIDBOX1 "█▀████▄█"
#define SOLIDBOX2 "████████"
#define BLANKBOX " "
#define DOTTEDLINE "---||---"
#ifndef NUMBOXCHARS
#define NUMBOXCHARS 8
#endif
/* Macro Definitions */
#define SCREEN_WRITE_METHOD video_system_flags.scrnwrt_flag
#define CGA_MODE_ON video_system_flags.cga_flag
#define MONO_MODE_ON video_system_flags.mda_flag
#define VGA_INSTALLED video_system_flags.vga_in_flag
#define VGA_COLOR_ON video_system_flags.vga_c_flag
#define VGA_MONO_ON video_system_flags.vga_m_flag
#define MCGA_COLOR_ON video_system_flags.mcga_c_flag
#define MCGA_MONO_ON video_system_flags.mcga_m_flag
#define EGA_INSTALLED video_system_flags.ega_in_flag
#define EGA_MODE_ON video_system_flags.ega_a_flag
#define EGA_COLOR_ON video_system_flags.ega_c_flag
#define EGA_MONO_ON video_system_flags.ega_m_flag
#define VGA_MODE_ON (VGA_COLOR_ON || VGA_MONO_ON)
#define MCGA_MODE_ON (MCGA_COLOR_ON || MCGA_MONO_ON)
#define CHECK_SNOW chksnow_
#define SCREEN_SEGMENT scrnseg_
#define VIDEO_PAGESIZE pagesize_
/* Video Macros */
#define LINEMODE43 (get_video_info(4) == 43)
#define LINEMODE50 (get_video_info(4) == 50)
#define LINEMODE25 (get_video_info(4) == 25)
#define CREATE_VIDEO_ATTRIBUTE(x,y) (((int)(x)<<4) + (y)) /* creates a video attribute */
#define GET_BGROUND_COLOR(c) ((int)(c)>>4)
#define GET_FGROUND_COLOR(c) ((int)(c) & 0x000F)
#define SCREEN_OFFSET(r,c,a) \
(((((r)-1)*num_screen_cols + (c)-1) + (a)*pagesize_)<<1)
#define GET_SEGMENT(x) \
((unsigned) ((long)(char far *)(x) >> 16))
#define GET_OFFSET(x) \
((unsigned) ((long)(char far *)(x) & 0x0000FFFF))
#define SCREEN_OFFSET_ATTR(r,c,a) (SCREEN_OFFSET((r),(c),(a))+1)
#define MAKE_FAR_POINTER(a,b) ((char far *)(((unsigned long)(a) << 16)+(b)))
#define GetVideoAttribute(row,col,page) get_chat((row),(col),(page),1)
#define GetVideoMode() get_video_info(1)
#define MoveCursor(row,col,page) goto_xy((row),(col),(page))
#define ReportCharacter(row,col,page) get_chat((row),(col),(page),0)
#if __cplusplus
extern "C" {
#endif
/* Fast Output/Non-window related Video Functions */
int CheckVideoPage P((int page));
void ClearRegion P((int urow, int ucol, int lrow, int lcol, int attr));
void ClearScreen P((int attr));
void GetCursorPosition P((int *row,int *col, int page));
void GetVideoBiosInfo P((VIDEO_CONFIG *video_struct));
void ScrollScreenUp P((int numlines, int urow, int ucol, int lrow,
int lcol, int attr));
void ScrollScreenDown P((int numlines, int urow, int ucol, int lrow,
int lcol, int attr));
int SetActiveVideoPage P((int page));
int SetVisibleVideoPage P((int page));
void SetVideoMode P((int modenum));
int SetVideoRows P((int numrows, int flag));
void VideoDrawBox P((int urow, int ucol, int lrow, int lcol, char *box));
void VideoDrawBoxAttr P((int urow, int ucol, int lrow, int lcol,
char *box, int attr));
void VideoFree P((VBLOCKPTR vid_block));
void VideoMove P((VBLOCKPTR vid_block));
void VideoPrintf P((char *format, ...));
void VideoPrintfAttr P((int attr, char *format, ...));
VBLOCKPTR VideoSave P((int urow, int ucol, int lrow, int lcol));
void VideoRestore P((VBLOCKPTR vid_block));
void VideoWriteString P((char *string, int row, int col));
void VideoWriteStringAttr P((char *string, int row, int col, int attr));
void VideoWriteAttributes P((char *string, int row, int col,
int length));
void VideoWriteCenterString P((char *string, int row));
void VideoWriteCenterStringAttr P((char *string, int row, int attr));
void VideoWriteCharAndAttr P((char *string, int row, int col,
int length));
void VideoWriteStringCC P((char *string, int row, int col));
void VideoWriteStringCCAttr P((char *string, int row, int col,
int attr));
void VideoWriteStringRJ P((char *string, int row, int col));
void VideoWriteStringRJAttr P((char *string, int row, int col,
int attr));
void VideoReadAttributes P((char *buffer, int row, int col,
int length));
void VideoReadCharacters P((char *buffer, int row, int col,
int length));
void VideoReadCharAndAttr P((char *buffer, int row, int col,
int length));
int InitializeScanLines(int,int);
int LoadCharacterSet(int,int);
void goto_xy P((int,int,int));
#if __cplusplus
}
#endif
#define VSTRUCT_DEF
#endif